<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html;charset=utf-8" isELIgnored="false" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>订单</title>
		<link rel="stylesheet"href="${pageContext.request.contextPath}/css/dingdan.css"type="text/css">
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.1.js"></script>
	<script type="text/javascript">
		$(function () {
			$("a[name='a2']").click(function () {
			    var id=$(this).next().html()
                if (window.confirm("确定要删除吗?")) {
                    window.location="${pageContext.request.contextPath}/deleteOrder.do?id="+id;
                }
            })
        })
	</script>
	</head>
	<body>
		<table class="table-head table-mod">
			<tbody>
				<tr>
					<th width="331px">宝贝</th>
					<th>单价</th>
					<th>数量</th>
					<th>实付款</th>
					<th>交易状态</th>
				</tr>
			</tbody>
		</table>
	<c:forEach items="${orderList}" var="order">
		<div class="dom">
			<label>
				<span class="time">
					<%--<input type="checkbox"/>--%>

					<span class="time"><fmt:formatDate value="${order.order_time}" pattern="yyyy-MM-dd HH :mm:ss"></fmt:formatDate></span>
				</span>
				<span>
					<span>订单号</span>
					<span>:</span>
					<span>${order.order_id}</span>
				</span>
				<span style="float:right">
					<span><a href="${pageContext.request.contextPath}/order/index.jsp?oid=${order.order_id}&totalprice=${order.total_price}">去支付</a></span>
					&nbsp;&nbsp;&nbsp;&nbsp;<span><a href="javascript:void(0)" name="a2">取消订单</a><span hidden="hidden">${order.order_id}</span></span>
				</span>
			</label>
		</div>
		<table class="tb">
			<c:forEach items="${order.itemList}" var="item" varStatus="s">
			<tr>
				<td width="330px">
					<div style="display: block;">
						<img src="${pageContext.request.contextPath}/productImages/${item.book.product_image}" width=70 border=0 style="float: left;"/>
						<p style="width: 230px; margin-left:10px; float: left;">
							<a href="javascript:void (0)"><span class="sp">${item.book.book_name}</span></a>
						</p>
					</div>
				</td>
				<td width="238px" align="center">
					<div>
						<p>${item.dang_price}</p>
					</div>
				</td>
				<td width="238px" align="center">${item.count}</td>
				<c:if test="${s.index==0}">
				<td class="boder" rowspan="${order.itemList.size()}">${order.total_price}</td>
				<td class="boder" width="239px" rowspan="${order.itemList.size()}">
					<div>
						<c:if test="${order.order_state==0}">
							<p style="color: red">未支付</p>
						</c:if>
						<c:if test="${order.order_state==1}">
							<p>交易成功</p>
						</c:if>
						<p>订单详情</p>
					</div>
				</td>
				</c:if>
			</tr>
			</c:forEach>

		</table>
	</c:forEach>


		
		<div style="margin: 50px;text-align: center;">
				<a href="javascript:history.go(-1);">
				<input 	class="button_1"  type="button" value="取消" /></a>  
	    </div>
	</body>
</html>